package net.courier.mq;

import java.io.Serializable;

import org.apache.commons.lang.SerializationUtils;

public class SerializableProtocol<T extends Serializable> implements Protocol<T, byte[]> {

	@Override
	public byte[] encode(Serializable object) {
		return SerializationUtils.serialize(object);
	}

	@SuppressWarnings("unchecked")
	@Override
	public T decode(byte[] data) {
		return (T) SerializationUtils.deserialize(data);
	}

}
